package com.sdp.th.db.th_eq_info.service.impl;

import java.util.List;

import org.springframework.stereotype.Service;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.sdp.th.db.th_eq_info.mapper.ThEqInfoMapper;
import com.sdp.th.db.th_eq_info.service.IThEqInfoService;
import com.sdp.th.entity.ThEqInfo;

/**
 * <p>
 * 设备台账 服务实现类
 * </p>
 *
 * @author zsp
 * @since 2025-04-12
 */
@Service
public class ThEqInfoServiceImpl extends ServiceImpl<ThEqInfoMapper, ThEqInfo> implements IThEqInfoService {

	@Override
	public ThEqInfo queryEqInfoByNo(String deviceNo) {
		LambdaQueryWrapper<ThEqInfo> lambdaQueryWrapper = new LambdaQueryWrapper<>();
		lambdaQueryWrapper.eq(ThEqInfo::getDeviceNo, deviceNo);
		return getOne(lambdaQueryWrapper,false);
	}

	@Override
	public List<ThEqInfo> queryEqInfoByType(String deviceType) {
		LambdaQueryWrapper<ThEqInfo> lambdaQueryWrapper = new LambdaQueryWrapper<>();
		lambdaQueryWrapper.eq(ThEqInfo::getDeviceType, deviceType);
		return list(lambdaQueryWrapper);
	}

	@Override
	public void delEqInfoByNo(String deviceNo) {
		LambdaQueryWrapper<ThEqInfo> lambdaQueryWrapper = new LambdaQueryWrapper<>();
		lambdaQueryWrapper.eq(ThEqInfo::getDeviceNo, deviceNo);
		remove(lambdaQueryWrapper);
	}

	@Override
	public List<ThEqInfo> queryEqInfoByNos(List<String> deviceNos) {
		LambdaQueryWrapper<ThEqInfo> lambdaQueryWrapper = new LambdaQueryWrapper<>();
		lambdaQueryWrapper.in(ThEqInfo::getDeviceNo, deviceNos);
		return list(lambdaQueryWrapper);
	}


}
